window.alert = function (str, url) {
    var shield = document.createElement("DIV");
    shield.id = "shield";
    shield.className = "shieldDiv"
    shield.style.position = "fixed";
    shield.style.left = "0px";
    shield.style.top = "0px";

    shield.style.width = "100%";
    shield.style.height = "100%";
    //弹出对话框时的背景颜色
    shield.style.background = "#111";
    shield.style.textAlign = "center";
    shield.style.zIndex = "25000";
    shield.style.opacity = "0.4";
    //背景透明 IE有效
    var alertFram = document.createElement("DIV");
    alertFram.id = "alertFram";
    alertFram.className = "alertFramDiv"
    alertFram.style.position = "fixed";
    alertFram.style.left = "50%";
    alertFram.style.top = "20%";
    alertFram.style.marginLeft = "-200px";
    alertFram.style.width = "400px";
    alertFram.style.height = "180px";
    alertFram.style.background = "#EF5F21;";
    alertFram.style.textAlign = "center";
    alertFram.style.zIndex = "25001";
    var strHtml = "<div style='padding: 2px 15px;background-color:#3498db;text-align: left;color:#fff;font-weight:300'><h6 style='font-size:15px;margin:11px 0;'>消息提醒</h6></div>"
    strHtml += "<div style='background-color:#fff;text-align:left;padding:15px;'><h4>" + str + "</h4></div>"
    strHtml += "<div style='padding: 14px 15px 15px;background-color:#f5f5f5;text-align:right'><button id='alert_button' class='btn green alert_button' type='button' onclick='doOk()'>确定</button></div>"
    alertFram.innerHTML = strHtml;
    document.body.appendChild(alertFram);
    document.body.appendChild(shield);
    this.doOk = function () {
        $(".shieldDiv").css('display', 'none');
        $(".alertFramDiv").css('display', 'none');
        document.body.onselectstart = function () {
        };
        if (url != undefined) {
            window.location.href = url;
        }
        ;


    }
    $(".alert_button").focus();
    document.body.onselectstart = function () {
        return false;
    };
}

function confirm(msg, callback) {
    if (msg == null) msg = "是否确认"
    showConfirm(msg, function (result) {
        if (callback) callback(result);
    })

}

function showConfirm(msg, callback) {
    $("#cfirm_modal").modal("show");
    $("#alertContentId").html(msg);
    $('#confirm_success').unbind('click').click(function () {
        if (callback) callback(true);
    });
    $('#confirm_fail').unbind('click').click(function () {
        if (callback) callback(false);
    });

}